﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using AutoR.Helpers;
using AutoR.Messages;
using AutoR.Models;
using AutoR.Tasks;
using Ionic.Zlib;
using LiteDB;
using Newtonsoft.Json;
using Newtonsoft.Json.Bson;
using Newtonsoft.Json.Linq;
using Xamarin.Forms;
using Xamarin.Forms.Analytics;

namespace AutoR.Services
{
	// Token: 0x02000142 RID: 322
	public class Remote
	{
		// Token: 0x06000732 RID: 1842 RVA: 0x00060AF1 File Offset: 0x0005ECF1
		public void ClearCookie()
		{
			this.cookie = "";
		}

		// Token: 0x06000733 RID: 1843 RVA: 0x00060B00 File Offset: 0x0005ED00
		public async Task<List<Server>> ServerList()
		{
			return JsonConvert.DeserializeObject<List<Server>>(await this.GetWebAsync("https://jianghanxia.gitee.io/pages/server.json", "", "Get", ""));
		}

		// Token: 0x06000734 RID: 1844 RVA: 0x00060B48 File Offset: 0x0005ED48
		public async Task<string> ChangeLog()
		{
			return await this.GetWebAsync("https://jianghanxia.gitee.io/pages/Changelog.md", "", "Get", "");
		}

		// Token: 0x06000735 RID: 1845 RVA: 0x00060B90 File Offset: 0x0005ED90
		public async Task Verify(string token)
		{
			try
			{
				long ok = DateTime.Now.Ticks;
				byte[] array = Encoding.Default.GetBytes(string.Format("{0}|{1}", ok, token));
				array = new Analytics().VerifyKey(array);
				byte[] array2 = Convert.FromBase64String(await this.GetWebAsync("https://get.baibaoyun.com/api/", "cd694e62ba74089c8df7aefb324c7910?login4=" + HttpUtility.UrlEncode(Convert.ToBase64String(array)), "Get", ""));
				byte[] bytes = Encoding.Default.GetBytes(ok.ToString());
				for (int i = 0; i < array2.Length; i++)
				{
					for (int j = 0; j < bytes.Length; j++)
					{
						array2[i] ^= bytes[j];
					}
				}
				if (Encoding.Default.GetString(array2) != "PASS")
				{
					Runtime.Game.IsCheck = true;
					throw new SysException("验证失败，请重新尝试");
				}
			}
			catch (Exception)
			{
				Runtime.Game.IsCheck = true;
				throw new SysException("验证失败，请重新尝试");
			}
		}

		// Token: 0x06000736 RID: 1846 RVA: 0x00060BE0 File Offset: 0x0005EDE0
		public async Task<string> CheckCDK(string cdk)
		{
			return await this.GetWebAsync("https://get.baibaoyun.com/api/", "cd694e62ba74089c8df7aefb324c7910?flag=login&RegCode=" + cdk + "&ProjectName=AutoR", "Get", "");
		}

		// Token: 0x06000737 RID: 1847 RVA: 0x00060C30 File Offset: 0x0005EE30
		public async Task<string> GetRegcodeTime(string cdk, string token)
		{
			return await this.GetWebAsync("https://get.baibaoyun.com/api/", "cd694e62ba74089c8df7aefb324c7910?flag=getregcodetime&RegCode=" + cdk + "&ProjectName=AutoR&AccessToken=" + token, "Get", "");
		}

		// Token: 0x06000738 RID: 1848 RVA: 0x00060C88 File Offset: 0x0005EE88
		public async Task BackupTask()
		{
			MemoryStream memoryStream = new MemoryStream();
			using (BsonWriter writer = new BsonWriter(memoryStream))
			{
				new Newtonsoft.Json.JsonSerializer().Serialize(writer, Runtime.Game.AttackTasks.ToList<AttackTask>());
				string t = JsonConvert.SerializeObject(new
				{
					name = Runtime.Game.Username,
					taskdata = Convert.ToBase64String(memoryStream.ToArray()),
					platform = Device.RuntimePlatform,
					global = Convert.ToBase64String(BsonSerializer.Serialize(BsonMapper.Global.ToDocument<GlobalConfig>(Runtime.Game.GlobalConfig))),
					explore = Convert.ToBase64String(BsonSerializer.Serialize(BsonMapper.Global.ToDocument<ExploreTask>(Runtime.Game.ExploreTask))),
					drill = Convert.ToBase64String(BsonSerializer.Serialize(BsonMapper.Global.ToDocument<DrillTask>(Runtime.Game.DrillTask))),
					campaign = Convert.ToBase64String(BsonSerializer.Serialize(BsonMapper.Global.ToDocument<CampaignTask>(Runtime.Game.CampaignTask))),
					repair = Convert.ToBase64String(BsonSerializer.Serialize(BsonMapper.Global.ToDocument<RepairTask>(Runtime.Game.RepairTask))),
					strengthen = Convert.ToBase64String(BsonSerializer.Serialize(BsonMapper.Global.ToDocument<StrengthenTask>(Runtime.Game.StrengthenTask))),
					award = Convert.ToBase64String(BsonSerializer.Serialize(BsonMapper.Global.ToDocument<AwardTask>(Runtime.Game.AwardTask))),
					friend = Convert.ToBase64String(BsonSerializer.Serialize(BsonMapper.Global.ToDocument<FriendTask>(Runtime.Game.FriendTask))),
					others = Convert.ToBase64String(BsonSerializer.Serialize(BsonMapper.Global.ToDocument<OthersConfig>(Runtime.Game.OthersConfig)))
				});
				JToken jtoken = JToken.Parse(await this.JSONAsync("http://47.98.206.15:8039/", "autoruser/_find", "Post", "{\"selector\":{\"name\":{\"$eq\":\"" + Runtime.Game.Username + "\"}},\"fields\": [\"_id\",\"_rev\"]}"));
				if (jtoken["docs"].HasValues)
				{
					JToken first = jtoken["docs"].First;
					await this.JSONAsync("http://47.98.206.15:8039/", string.Format("autoruser/{0}?rev={1}", first["_id"], first["_rev"]), "PUT", t);
				}
				else
				{
					await this.JSONAsync("http://47.98.206.15:8039/", "autoruser", "Post", t);
				}
				t = null;
			}
			BsonWriter writer = null;
		}

		// Token: 0x06000739 RID: 1849 RVA: 0x00060CD0 File Offset: 0x0005EED0
		public async Task<bool> RestoreTask(bool func)
		{
			JToken jtoken = JToken.Parse(await this.JSONAsync("http://47.98.206.15:8039/", "autoruser/_find", "Post", "{\"selector\":{\"name\":{\"$eq\":\"" + Runtime.Game.Username + "\"}}}"));
			bool result;
			if (jtoken["docs"].HasValues)
			{
				if (func && jtoken["docs"].First["global"] != null)
				{
					Runtime.Game.GlobalConfig = BsonMapper.Global.ToObject<GlobalConfig>(BsonSerializer.Deserialize(Convert.FromBase64String(jtoken["docs"].First["global"].ToString()), false));
					Runtime.Game.ExploreTask = BsonMapper.Global.ToObject<ExploreTask>(BsonSerializer.Deserialize(Convert.FromBase64String(jtoken["docs"].First["explore"].ToString()), false));
					Runtime.Game.DrillTask = BsonMapper.Global.ToObject<DrillTask>(BsonSerializer.Deserialize(Convert.FromBase64String(jtoken["docs"].First["drill"].ToString()), false));
					Runtime.Game.CampaignTask = BsonMapper.Global.ToObject<CampaignTask>(BsonSerializer.Deserialize(Convert.FromBase64String(jtoken["docs"].First["campaign"].ToString()), false));
					Runtime.Game.RepairTask = BsonMapper.Global.ToObject<RepairTask>(BsonSerializer.Deserialize(Convert.FromBase64String(jtoken["docs"].First["repair"].ToString()), false));
					Runtime.Game.StrengthenTask = BsonMapper.Global.ToObject<StrengthenTask>(BsonSerializer.Deserialize(Convert.FromBase64String(jtoken["docs"].First["strengthen"].ToString()), false));
					Runtime.Game.AwardTask = BsonMapper.Global.ToObject<AwardTask>(BsonSerializer.Deserialize(Convert.FromBase64String(jtoken["docs"].First["award"].ToString()), false));
					Runtime.Game.FriendTask = BsonMapper.Global.ToObject<FriendTask>(BsonSerializer.Deserialize(Convert.FromBase64String(jtoken["docs"].First["friend"].ToString()), false));
					Runtime.Game.OthersConfig = BsonMapper.Global.ToObject<OthersConfig>(BsonSerializer.Deserialize(Convert.FromBase64String(jtoken["docs"].First["others"].ToString()), false));
				}
				using (BsonReader bsonReader = new BsonReader(new MemoryStream(Convert.FromBase64String(jtoken["docs"].First["taskdata"].ToString()))))
				{
					bsonReader.ReadRootValueAsArray = true;
					List<AttackTask> list = new Newtonsoft.Json.JsonSerializer().Deserialize<List<AttackTask>>(bsonReader);
					if (list != null)
					{
						Runtime.Game.AttackTasks = new ObservableCollection<AttackTask>(list);
					}
				}
				result = true;
			}
			else
			{
				result = false;
			}
			return result;
		}

		// Token: 0x0600073A RID: 1850 RVA: 0x00060D20 File Offset: 0x0005EF20
		public async Task UploadTask(AttackTask task)
		{
			MemoryStream memoryStream = new MemoryStream();
			using (BsonWriter bsonWriter = new BsonWriter(memoryStream))
			{
				new Newtonsoft.Json.JsonSerializer().Serialize(bsonWriter, task);
			}
			string taskdata = Convert.ToBase64String(memoryStream.ToArray());
			string postData = JsonConvert.SerializeObject(new
			{
				name = task.Name,
				author = task.Author,
				memo = task.Memo,
				node = task.NodeID,
				taskdata = taskdata,
				platform = Device.RuntimePlatform,
				time = DateTime.Now,
				classify = task.Classify
			});
			await this.JSONAsync("http://47.98.206.15:8039/", "autortask", "Post", postData);
		}

		// Token: 0x0600073B RID: 1851 RVA: 0x00060D70 File Offset: 0x0005EF70
		public async Task<string> GetOlTaskList()
		{
			return await this.JSONAsync("http://47.98.206.15:8039/", "autortask/_design/view/_view/list", "Get", "");
		}

		// Token: 0x0600073C RID: 1852 RVA: 0x00060DB8 File Offset: 0x0005EFB8
		public async Task<AttackTask> GetOlTaskData(string id)
		{
			TaskAwaiter<string> taskAwaiter = this.JSONAsync("http://47.98.206.15:8039/", "autortask/" + id, "Get", "").GetAwaiter();
			if (!taskAwaiter.IsCompleted)
			{
				await taskAwaiter;
				TaskAwaiter<string> taskAwaiter2;
				taskAwaiter = taskAwaiter2;
				taskAwaiter2 = default(TaskAwaiter<string>);
			}
			AttackTask result;
			using (BsonReader bsonReader = new BsonReader(new MemoryStream(Convert.FromBase64String(JToken.Parse(taskAwaiter.GetResult())["taskdata"].ToString()))))
			{
				AttackTask attackTask = new Newtonsoft.Json.JsonSerializer().Deserialize<AttackTask>(bsonReader);
				attackTask.Enabled = false;
				foreach (RuleFleet ruleFleet in attackTask.RuleFleet)
				{
					using (List<int>.Enumerator enumerator2 = ruleFleet.ShipID.ToList<int>().GetEnumerator())
					{
						while (enumerator2.MoveNext())
						{
							int i = enumerator2.Current;
							if (Runtime.Game.UserShip.All((UserShip s) => s.id != i))
							{
								ruleFleet.ShipID.Remove(i);
							}
						}
					}
				}
				using (List<int>.Enumerator enumerator2 = attackTask.ShipID.ToList<int>().GetEnumerator())
				{
					while (enumerator2.MoveNext())
					{
						int si = enumerator2.Current;
						if (Runtime.Game.UserShip.All((UserShip s) => s.id != si))
						{
							attackTask.ShipID.Remove(si);
						}
					}
				}
				result = attackTask;
			}
			return result;
		}

		// Token: 0x0600073D RID: 1853 RVA: 0x00060E08 File Offset: 0x0005F008
		public async Task UpdateTask(OlTask task)
		{
			JToken jtoken = JToken.Parse(await this.JSONAsync("http://47.98.206.15:8039/", "autortask/" + task._id, "Get", ""));
			task.taskdata = jtoken["taskdata"].ToString();
			await this.JSONAsync("http://47.98.206.15:8039/", string.Format("autortask/{0}?rev={1}", task._id, jtoken["_rev"]), "PUT", JsonConvert.SerializeObject(task));
		}

		// Token: 0x0600073E RID: 1854 RVA: 0x00060E58 File Offset: 0x0005F058
		public async Task DelTask(OlTask task)
		{
			JToken jtoken = JToken.Parse(await this.JSONAsync("http://47.98.206.15:8039/", "autortask/" + task._id, "Get", ""));
			await this.JSONAsync("http://47.98.206.15:8039/", string.Format("autortask/{0}?rev={1}", task._id, jtoken["_rev"]), "DELETE", "");
		}

		// Token: 0x0600073F RID: 1855 RVA: 0x00060EA8 File Offset: 0x0005F0A8
		public async Task<string> CheckVer()
		{
			return await this.GetUrlAsync(Runtime.Server.URL, string.Concat(new string[]
			{
				"/index/checkVer/",
				Runtime.Server.Version,
				"/",
				Runtime.Server.Channel,
				"/2"
			}), "Get", "");
		}

		// Token: 0x06000740 RID: 1856 RVA: 0x00060EF0 File Offset: 0x0005F0F0
		public async Task<JToken> GetInitConfigs()
		{
			return await this.GetDataAsync(Runtime.LoginServer, "index/getInitConfigs/", "Get", "", 0);
		}

		// Token: 0x06000741 RID: 1857 RVA: 0x00060F38 File Offset: 0x0005F138
		public async Task<JToken> HLLogin(string uid, string channelUid, string accessToken)
		{
			this.ClearCookie();
			return await this.GetDataAsync(Runtime.LoginServer, string.Concat(new string[]
			{
				"index/hlLogin/",
				uid,
				"/",
				Runtime.Server.Qu,
				"/",
				channelUid,
				"/",
				accessToken,
				"/161"
			}), "Get", "", 0);
		}

		// Token: 0x06000742 RID: 1858 RVA: 0x00060F98 File Offset: 0x0005F198
		public async Task<JToken> HMLogin(string userId, string password)
		{
			this.ClearCookie();
			JToken jtoken = JToken.Parse(await this.TokenAsync(Runtime.HMLoginServer, "1.0/get/login/@self", (Runtime.Game.ServerType == 3) ? string.Concat(new string[]
			{
				"{\"appServerType\":\"0\",\"password\":\"",
				password,
				"\",\"appId\":\"0\",\"userName\":\"",
				userId,
				"\"}"
			}) : string.Concat(new string[]
			{
				"{\"password\":\"",
				password,
				"\",\"appid\":\"0\",\"app_server_type\":\"0\",\"platform\":\"0\",\"username\":\"",
				userId,
				"\"}"
			})));
			string str = (Runtime.Game.ServerType == 3) ? jtoken["token"].ToString() : jtoken["access_token"].ToString();
			return await this.GetDataAsync(Runtime.LoginServer, "index/hmLogin/" + str, "Get", "", 0);
		}

		// Token: 0x06000743 RID: 1859 RVA: 0x00060FF0 File Offset: 0x0005F1F0
		public async Task<JToken> PassportLogin(string userId, string password)
		{
			this.ClearCookie();
			return await this.GetDataAsync(Runtime.LoginServer, "index/passportLogin/", "Post", "username=" + this.Base64Encode(Encoding.UTF8, userId) + "&pwd=" + this.Base64Encode(Encoding.UTF8, password), 0);
		}

		// Token: 0x06000744 RID: 1860 RVA: 0x00061048 File Offset: 0x0005F248
		public async Task<JToken> Login(string userId)
		{
			return await this.GetDataAsync(Runtime.GameUrl, string.Concat(new string[]
			{
				"index/login/",
				userId,
				"?&client_version=",
				Runtime.Server.Version,
				"&phone_type=R17&phone_version=8.1&ratio=1920*1080&udid=&source=android&affiliate=WIFI"
			}), "Get", "", 0);
		}

		// Token: 0x06000745 RID: 1861 RVA: 0x00061098 File Offset: 0x0005F298
		public async Task<InitDataVO> InitGame()
		{
			JToken jtoken = await this.GetDataAsync(Runtime.GameUrl, "api/initGame/?&crazy=1", "Get", "", 0);
			JToken json = jtoken;
			if (json["marketingData"]["activeList"] != null && json["marketingData"]["activeList"].HasValues)
			{
				OceanData oceanData = await this.GetOceanData();
				List<PVELevel> list = new List<PVELevel>();
				foreach (PVELevel pvelevel in oceanData.OceanLevel)
				{
					using (List<int>.Enumerator enumerator2 = pvelevel.init_nodes.GetEnumerator())
					{
						while (enumerator2.MoveNext())
						{
							int node = enumerator2.Current;
							list.Add(new PVELevel
							{
								id = node,
								title = pvelevel.title,
								subTitle = pvelevel.subTitle + " " + oceanData.OceanNode.First((PVENode i) => i.id == node).flag
							});
						}
					}
				}
				oceanData.OceanLevel = list;
				oceanData.OceanNode.ForEach(delegate(PVENode i)
				{
					i.pveLevelId = i.start_node_id;
				});
				Runtime.Configs.OceanData = oceanData;
			}
			return JsonConvert.DeserializeObject<InitDataVO>(json.ToString());
		}

		// Token: 0x06000746 RID: 1862 RVA: 0x000610E0 File Offset: 0x0005F2E0
		public async Task<PVEConfig> GetPVEData()
		{
			return JsonConvert.DeserializeObject<PVEConfig>((await this.GetDataAsync(Runtime.GameUrl, "pve/getPveData", "Get", "", 0)).ToString());
		}

		// Token: 0x06000747 RID: 1863 RVA: 0x00061128 File Offset: 0x0005F328
		public async Task<PVEEventConfig> GetPeventPVEData()
		{
			JToken jtoken = await this.GetDataAsync(Runtime.GameUrl, "pevent/getPveData/", "Get", "", 0);
			PVEEventConfig result;
			if (jtoken.HasValues)
			{
				PVEEventConfig pe = JsonConvert.DeserializeObject<PVEEventConfig>(jtoken.ToString());
				JToken jtoken2 = await this.GetDataAsync(Runtime.GameUrl, "guard/getThreeUserData/", "Get", "", 0);
				try
				{
					pe.GuardData = JsonConvert.DeserializeObject<List<GuardData>>(jtoken2["pveEventLevel"].ToString());
				}
				catch (Exception)
				{
				}
				result = pe;
			}
			else
			{
				result = new PVEEventConfig();
			}
			return result;
		}

		// Token: 0x06000748 RID: 1864 RVA: 0x00061170 File Offset: 0x0005F370
		public async Task<JToken> BseaData()
		{
			return await this.GetDataAsync(Runtime.GameUrl, "bsea/getData/", "Get", "", 0);
		}

		// Token: 0x06000749 RID: 1865 RVA: 0x000611B8 File Offset: 0x0005F3B8
		public async Task<JToken> GetUserData()
		{
			return await this.GetDataAsync(Runtime.GameUrl, "active/getUserData/", "Get", "", 0);
		}

		// Token: 0x0600074A RID: 1866 RVA: 0x00061200 File Offset: 0x0005F400
		public async Task<LiveCookInfo> GetUserInfo()
		{
			return JsonConvert.DeserializeObject<LiveCookInfo>((await this.GetDataAsync(Runtime.GameUrl, "live/getUserInfo", "Get", "", 0)).ToString());
		}

		// Token: 0x0600074B RID: 1867 RVA: 0x00061248 File Offset: 0x0005F448
		public async Task<List<UserPVELevel>> PVEGetUserData()
		{
			return JsonConvert.DeserializeObject<List<UserPVELevel>>((await this.GetDataAsync(Runtime.GameUrl, "pve/getUserData/", "Get", "", 0))["pveLevel"].ToString());
		}

		// Token: 0x0600074C RID: 1868 RVA: 0x00061290 File Offset: 0x0005F490
		public async Task<JToken> CampaignUserData()
		{
			return await this.GetDataAsync(Runtime.GameUrl, "campaign/getUserData/", "Get", "", 0);
		}

		// Token: 0x0600074D RID: 1869 RVA: 0x000612D8 File Offset: 0x0005F4D8
		public async Task<OceanData> GetOceanData()
		{
			return JsonConvert.DeserializeObject<OceanData>((await this.GetDataAsync(Runtime.GameUrl, "ocean/getOceanData/", "Get", "", 0)).ToString());
		}

		// Token: 0x0600074E RID: 1870 RVA: 0x00061320 File Offset: 0x0005F520
		public async Task<RankListDestroy> GetRank()
		{
			return JsonConvert.DeserializeObject<RankListDestroy>((await this.GetDataAsync(Runtime.GameUrl, "rank/getData/", "Get", "", 0))["destroyRank"].ToString());
		}

		// Token: 0x0600074F RID: 1871 RVA: 0x00061368 File Offset: 0x0005F568
		public async Task<ExploreVo> ExploreStart(int fleetId, int exploreId)
		{
			return JsonConvert.DeserializeObject<ExploreVo>((await this.GetDataAsync(Runtime.GameUrl, string.Format("explore/start/{0}/{1}/", fleetId, exploreId), "Post", string.Format("pve_level=1&pid={0}", new Random().Next(406053, 638088)), 0))["pveExploreVo"].ToString());
		}

		// Token: 0x06000750 RID: 1872 RVA: 0x000613C0 File Offset: 0x0005F5C0
		public async Task<ExploreVo> ExploreCancel(int exploreId)
		{
			return JsonConvert.DeserializeObject<ExploreVo>((await this.GetDataAsync(Runtime.GameUrl, string.Format("explore/cancel/{0}/", exploreId), "Get", "", 0))["pveExploreVo"].ToString());
		}

		// Token: 0x06000751 RID: 1873 RVA: 0x00061410 File Offset: 0x0005F610
		public async Task<FinishExplore> ExploreResult(int exploreId)
		{
			return JsonConvert.DeserializeObject<FinishExplore>((await this.GetDataAsync(Runtime.GameUrl, string.Format("explore/getResult/{0}/", exploreId), "Get", "", 0)).ToString());
		}

		// Token: 0x06000752 RID: 1874 RVA: 0x00061460 File Offset: 0x0005F660
		public async Task<JToken> RemoveBoat(int fleetId, int pos)
		{
			return await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/removeBoat/{0}/{1}/", fleetId, pos), "Get", "", 0);
		}

		// Token: 0x06000753 RID: 1875 RVA: 0x000614B8 File Offset: 0x0005F6B8
		public async Task<UpdateFleet> ChangeBoat(int fleetId, int shipId, int pos)
		{
			return JsonConvert.DeserializeObject<UpdateFleet>((await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/changeBoat/{0}/{1}/{2}/", fleetId, shipId, pos), "Get", "", 0)).ToString());
		}

		// Token: 0x06000754 RID: 1876 RVA: 0x00061518 File Offset: 0x0005F718
		public async Task<UpdateFleet> InstantFleet(int fleetId, int[] shipId)
		{
			return JsonConvert.DeserializeObject<UpdateFleet>((await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/instantFleet/{0}/[{1}]/", fleetId, string.Join<int>(",", shipId)), "Get", "", 0)).ToString());
		}

		// Token: 0x06000755 RID: 1877 RVA: 0x00061570 File Offset: 0x0005F770
		public async Task<InstantRepairShip> InstantRepairShip(int shipId)
		{
			return JsonConvert.DeserializeObject<InstantRepairShip>((await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/instantRepairShips/[{0}]", shipId), "Get", "", 0)).ToString());
		}

		// Token: 0x06000756 RID: 1878 RVA: 0x000615C0 File Offset: 0x0005F7C0
		public async Task<InstantRepair> InstantRepair(int dockId)
		{
			return JsonConvert.DeserializeObject<InstantRepair>((await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/instantRepair/{0}/", dockId), "Get", "", 0)).ToString());
		}

		// Token: 0x06000757 RID: 1879 RVA: 0x00061610 File Offset: 0x0005F810
		public async Task<Repair> Rubdown(int shipId)
		{
			return JsonConvert.DeserializeObject<Repair>((await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/rubdown/{0}", shipId), "Get", "", 0)).ToString());
		}

		// Token: 0x06000758 RID: 1880 RVA: 0x00061660 File Offset: 0x0005F860
		public async Task<Repair> Repair(int shipId, int dockId)
		{
			return JsonConvert.DeserializeObject<Repair>((await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/repair/{0}/{1}/", shipId, dockId), "Get", "", 0)).ToString());
		}

		// Token: 0x06000759 RID: 1881 RVA: 0x000616B8 File Offset: 0x0005F8B8
		public async Task<Repair> RepairComplete(int shipId, int dockId)
		{
			return JsonConvert.DeserializeObject<Repair>((await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/repairComplete/{0}/{1}/", dockId, shipId), "Get", "", 0)).ToString());
		}

		// Token: 0x0600075A RID: 1882 RVA: 0x00061710 File Offset: 0x0005F910
		public async Task<SupplyFleet> SupplyFleet(int[] shipId, int nodeID = 0)
		{
			return JsonConvert.DeserializeObject<SupplyFleet>((await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/supplyBoats/[{0}]/{1}/0/", string.Join<int>(",", shipId), nodeID), "Get", "", 0)).ToString());
		}

		// Token: 0x0600075B RID: 1883 RVA: 0x00061768 File Offset: 0x0005F968
		public async Task<DismantleBoat> DismantleBoat(int[] shipId, int throwEquipment)
		{
			return JsonConvert.DeserializeObject<DismantleBoat>((await this.GetDataAsync(Runtime.GameUrl, string.Format("dock/dismantleBoat/[{0}]/{1}/", string.Join<int>(",", shipId), throwEquipment), "Get", "", 0)).ToString());
		}

		// Token: 0x0600075C RID: 1884 RVA: 0x000617C0 File Offset: 0x0005F9C0
		public async Task<List<UserEquipment>> DismantleEquipment(int cid, int num)
		{
			return JsonConvert.DeserializeObject<List<UserEquipment>>((await this.GetDataAsync(Runtime.GameUrl, "dock/dismantleEquipment/", "Post", string.Format("content={{\"{0}\":{1}}}", cid, num), 0))["equipmentVo"].ToString());
		}

		// Token: 0x0600075D RID: 1885 RVA: 0x00061818 File Offset: 0x0005FA18
		public async Task<FinishQuest> GetAward(int taskCid)
		{
			return JsonConvert.DeserializeObject<FinishQuest>((await this.GetDataAsync(Runtime.GameUrl, string.Format("task/getAward/{0}/", taskCid), "Get", "", 0)).ToString());
		}

		// Token: 0x0600075E RID: 1886 RVA: 0x00061868 File Offset: 0x0005FA68
		public async Task<SkillShip> SkillLevelUp(int shipId)
		{
			return JsonConvert.DeserializeObject<SkillShip>((await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/skillLevelUp/{0}", shipId), "Get", "", 0)).ToString());
		}

		// Token: 0x0600075F RID: 1887 RVA: 0x000618B8 File Offset: 0x0005FAB8
		public async Task<StrengthenBoat> Strengthen(int shipin, int[] shipId)
		{
			return JsonConvert.DeserializeObject<StrengthenBoat>((await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/strengthen/{0}/[{1}]", shipin, string.Join<int>(",", shipId)), "Get", "", 0)).ToString());
		}

		// Token: 0x06000760 RID: 1888 RVA: 0x00061910 File Offset: 0x0005FB10
		public async Task<JToken> LockShip(int shipId)
		{
			return await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/lock/{0}/", shipId), "Get", "", 0);
		}

		// Token: 0x06000761 RID: 1889 RVA: 0x00061960 File Offset: 0x0005FB60
		public async Task<JToken> LoginAward()
		{
			return await this.GetDataAsync(Runtime.GameUrl, "active/getLoginAward/c3ecc6250c89e88d83832e3395efb973/", "Get", "", 0);
		}

		// Token: 0x06000762 RID: 1890 RVA: 0x000619A8 File Offset: 0x0005FBA8
		public async Task<StrengthenBoat> ChangeEquipment(int shipId, int equipId, int equipPos)
		{
			return JsonConvert.DeserializeObject<StrengthenBoat>((await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/changeEquipment/{0}/{1}/{2}", shipId, equipId, equipPos), "Get", "", 0)).ToString());
		}

		// Token: 0x06000763 RID: 1891 RVA: 0x00061A08 File Offset: 0x0005FC08
		public async Task<JToken> RecondEquipment(int shipId, int equipDock)
		{
			return await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/recondEquipment/{0}/{1}", shipId, equipDock), "Get", "", 0);
		}

		// Token: 0x06000764 RID: 1892 RVA: 0x00061A60 File Offset: 0x0005FC60
		public async Task<JToken> UseEquipmentRecond(int shipId, int equipDock)
		{
			return await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/useEquipmentRecond/{0}/{1}", shipId, equipDock), "Get", "", 0);
		}

		// Token: 0x06000765 RID: 1893 RVA: 0x00061AB8 File Offset: 0x0005FCB8
		public async Task<StrengthenBoat> RemoveEquipment(int shipId, int equipPos)
		{
			return JsonConvert.DeserializeObject<StrengthenBoat>((await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/removeEquipment/{0}/{1}", shipId, equipPos), "Get", "", 0)).ToString());
		}

		// Token: 0x06000766 RID: 1894 RVA: 0x00061B10 File Offset: 0x0005FD10
		public async Task<int> SetSecretary(int shipId)
		{
			return (await this.GetDataAsync(Runtime.GameUrl, string.Format("boat/setSecretary/{0}/", shipId), "Get", "", 0)).Value<int>("shipId");
		}

		// Token: 0x06000767 RID: 1895 RVA: 0x00061B60 File Offset: 0x0005FD60
		public async Task<List<DockInfo>> BuildBoat(int dockId, int oil, int ammo, int steel, int aluminum)
		{
			JToken jtoken = await this.GetDataAsync(Runtime.GameUrl, string.Format("dock/buildBoat/{0}/{1}/{2}/{3}/{4}", new object[]
			{
				dockId,
				oil,
				steel,
				ammo,
				aluminum
			}), "Get", "", 0);
			Runtime.Game.Package.UpdateUserPackage(JsonConvert.DeserializeObject<List<UserItem>>(jtoken["packageVo"].ToString()));
			return JsonConvert.DeserializeObject<List<DockInfo>>(jtoken["dockVo"].ToString());
		}

		// Token: 0x06000768 RID: 1896 RVA: 0x00061BD0 File Offset: 0x0005FDD0
		public async Task<List<EquipmentDockInfo>> BuildEquipment(int dockId, int oil, int ammo, int steel, int aluminum)
		{
			JToken jtoken = await this.GetDataAsync(Runtime.GameUrl, string.Format("dock/buildEquipment/{0}/{1}/{2}/{3}/{4}", new object[]
			{
				dockId,
				oil,
				steel,
				ammo,
				aluminum
			}), "Get", "", 0);
			Runtime.Game.Package.UpdateUserPackage(JsonConvert.DeserializeObject<List<UserItem>>(jtoken["packageVo"].ToString()));
			return JsonConvert.DeserializeObject<List<EquipmentDockInfo>>(jtoken["equipmentDockVo"].ToString());
		}

		// Token: 0x06000769 RID: 1897 RVA: 0x00061C40 File Offset: 0x0005FE40
		public async Task<GetShipData> GetBoat(int dockId)
		{
			return JsonConvert.DeserializeObject<GetShipData>((await this.GetDataAsync(Runtime.GameUrl, string.Format("dock/getBoat/{0}", dockId), "Get", "", 0)).ToString());
		}

		// Token: 0x0600076A RID: 1898 RVA: 0x00061C90 File Offset: 0x0005FE90
		public async Task<GetEquipData> GetEquipment(int dockId)
		{
			return JsonConvert.DeserializeObject<GetEquipData>((await this.GetDataAsync(Runtime.GameUrl, string.Format("dock/getEquipment/{0}", dockId), "Get", "", 0)).ToString());
		}

		// Token: 0x0600076B RID: 1899 RVA: 0x00061CE0 File Offset: 0x0005FEE0
		public async Task<List<DockInfo>> InstantBuild(int dockId)
		{
			JToken jtoken = await this.GetDataAsync(Runtime.GameUrl, string.Format("dock/instantBuild/{0}/", dockId), "Get", "", 0);
			Runtime.Game.Package.UpdateUserPackage(JsonConvert.DeserializeObject<List<UserItem>>(jtoken["packageVo"].ToString()));
			return JsonConvert.DeserializeObject<List<DockInfo>>(jtoken["dockVo"].ToString());
		}

		// Token: 0x0600076C RID: 1900 RVA: 0x00061D30 File Offset: 0x0005FF30
		public async Task<List<EquipmentDockInfo>> InstantEquipment(int dockId)
		{
			JToken jtoken = await this.GetDataAsync(Runtime.GameUrl, string.Format("dock/instantEquipmentBuild/{0}/", dockId), "Get", "", 0);
			Runtime.Game.Package.UpdateUserPackage(JsonConvert.DeserializeObject<List<UserItem>>(jtoken["packageVo"].ToString()));
			return JsonConvert.DeserializeObject<List<EquipmentDockInfo>>(jtoken["equipmentDockVo"].ToString());
		}

		// Token: 0x0600076D RID: 1901 RVA: 0x00061D80 File Offset: 0x0005FF80
		public async Task<bool> OceanChallenge(int nodeid, int fleetId)
		{
			return (await this.GetDataAsync(Runtime.GameUrl, string.Format("ocean/cha11enge/{0}/{1}/0/", nodeid, fleetId), "Post", string.Format("pve_level=1&pid={0}", new Random().Next(406053, 1380880)), 0)).Value<bool>("status");
		}

		// Token: 0x0600076E RID: 1902 RVA: 0x00061DD8 File Offset: 0x0005FFD8
		public async Task<int> OceanNext()
		{
			return (await this.GetDataAsync(Runtime.GameUrl, "ocean/newNext/", "Get", "", 0)).Value<int>("node");
		}

		// Token: 0x0600076F RID: 1903 RVA: 0x00061E20 File Offset: 0x00060020
		public async Task<FoundEnemyVO> OceanSpy(int node)
		{
			FoundEnemyVO foundEnemyVO = JsonConvert.DeserializeObject<FoundEnemyVO>((await this.GetDataAsync(Runtime.GameUrl, "ocean/spy/", "Get", "", 0))["enemyVO"].ToString());
			AutoR.Helpers.Extensions.UpdateStatFoundEnemy(node, foundEnemyVO);
			return foundEnemyVO;
		}

		// Token: 0x06000770 RID: 1904 RVA: 0x00061E70 File Offset: 0x00060070
		public async Task<SkipWar> OceanSkipWar(int node)
		{
			SkipWar skipWar = JsonConvert.DeserializeObject<SkipWar>((await this.GetDataAsync(Runtime.GameUrl, "ocean/SkipWar/", "Get", "", 0)).ToString());
			AutoR.Helpers.Extensions.UpdateStatSkipWar(node, skipWar.isSuccess);
			return skipWar;
		}

		// Token: 0x06000771 RID: 1905 RVA: 0x00061EC0 File Offset: 0x000600C0
		public async Task<DealNode> OceanDealto(int nodeid, int fleetId, Formation formatin)
		{
			return JsonConvert.DeserializeObject<DealNode>((await this.GetDataAsync(Runtime.GameUrl, string.Format("ocean/dealto/{0}/{1}/{2}/", nodeid, fleetId, (int)formatin), "Get", "", 0)).ToString());
		}

		// Token: 0x06000772 RID: 1906 RVA: 0x00061F20 File Offset: 0x00060120
		public async Task<BattleResult> OceanWarResult(bool isNightWar)
		{
			return JsonConvert.DeserializeObject<BattleResult>((await this.GetDataAsync(Runtime.GameUrl, string.Format("ocean/getWarResult/{0}/", Convert.ToInt32(isNightWar)), "Get", "", 0)).ToString());
		}

		// Token: 0x06000773 RID: 1907 RVA: 0x00061F70 File Offset: 0x00060170
		public async Task<bool> Challenge(int nodeid, int fleetId)
		{
			return (await this.GetDataAsync(Runtime.GameUrl, string.Format("pve/cha11enge/{0}/{1}/0/", nodeid, fleetId), "Post", string.Format("pve_level=1&pid={0}", new Random().Next(406053, 638088)), 0)).Value<bool>("status");
		}

		// Token: 0x06000774 RID: 1908 RVA: 0x00061FC8 File Offset: 0x000601C8
		public async Task<int> PVENext()
		{
			return (await this.GetDataAsync(Runtime.GameUrl, "pve/newNext/", "Get", "", 0)).Value<int>("node");
		}

		// Token: 0x06000775 RID: 1909 RVA: 0x00062010 File Offset: 0x00060210
		public async Task<FoundEnemyVO> PVESpy(int node)
		{
			FoundEnemyVO foundEnemyVO = JsonConvert.DeserializeObject<FoundEnemyVO>((await this.GetDataAsync(Runtime.GameUrl, "pve/spy/", "Get", "", 0))["enemyVO"].ToString());
			AutoR.Helpers.Extensions.UpdateStatFoundEnemy(node, foundEnemyVO);
			return foundEnemyVO;
		}

		// Token: 0x06000776 RID: 1910 RVA: 0x00062060 File Offset: 0x00060260
		public async Task<SkipWar> SkipWar(int node)
		{
			SkipWar skipWar = JsonConvert.DeserializeObject<SkipWar>((await this.GetDataAsync(Runtime.GameUrl, "pve/SkipWar/", "Get", "", 0)).ToString());
			AutoR.Helpers.Extensions.UpdateStatSkipWar(node, skipWar.isSuccess);
			return skipWar;
		}

		// Token: 0x06000777 RID: 1911 RVA: 0x000620B0 File Offset: 0x000602B0
		public async Task<DealNode> PVEDealto(int nodeid, int fleetId, Formation formatin)
		{
			return JsonConvert.DeserializeObject<DealNode>((await this.GetDataAsync(Runtime.GameUrl, string.Format("pve/dealto/{0}/{1}/{2}/", nodeid, fleetId, (int)formatin), "Get", "", 0)).ToString());
		}

		// Token: 0x06000778 RID: 1912 RVA: 0x00062110 File Offset: 0x00060310
		public async Task<BattleResult> PVEWarResult(bool isNightWar)
		{
			return JsonConvert.DeserializeObject<BattleResult>((await this.GetDataAsync(Runtime.GameUrl, string.Format("pve/getWarResult/{0}/", Convert.ToInt32(isNightWar)), "Get", "", 0)).ToString());
		}

		// Token: 0x06000779 RID: 1913 RVA: 0x00062160 File Offset: 0x00060360
		public async Task<List<PVPOpponent>> GetPVPList()
		{
			return JsonConvert.DeserializeObject<List<PVPOpponent>>((await this.GetDataAsync(Runtime.GameUrl, "pvp/getChallengeList/", "Get", "", 0))["list"].ToString());
		}

		// Token: 0x0600077A RID: 1914 RVA: 0x000621A8 File Offset: 0x000603A8
		public async Task<FoundEnemyVO> PVPSpy(int fleetId, long nodeId)
		{
			return JsonConvert.DeserializeObject<FoundEnemyVO>((await this.GetDataAsync(Runtime.GameUrl, string.Format("pvp/spy/{0}/{1}/", nodeId, fleetId), "Get", "", 0))["enemyVO"].ToString());
		}

		// Token: 0x0600077B RID: 1915 RVA: 0x00062200 File Offset: 0x00060400
		public async Task<WarReport> PVPChallenge(int uid, int fleetId, Formation formatin)
		{
			return JsonConvert.DeserializeObject<WarReport>((await this.GetDataAsync(Runtime.GameUrl, string.Format("pvp/challenge/{0}/{1}/{2}", uid, fleetId, (int)formatin), "Get", "", 0))["warReport"].ToString());
		}

		// Token: 0x0600077C RID: 1916 RVA: 0x00062260 File Offset: 0x00060460
		public async Task<BattleResult> PVPWarResult(bool isNightWar)
		{
			return JsonConvert.DeserializeObject<BattleResult>((await this.GetDataAsync(Runtime.GameUrl, string.Format("pvp/getWarResult/{0}/", Convert.ToInt32(isNightWar)), "Get", "", 0)).ToString());
		}

		// Token: 0x0600077D RID: 1917 RVA: 0x000622B0 File Offset: 0x000604B0
		public async Task<List<Friend>> FriendList()
		{
			return JsonConvert.DeserializeObject<List<Friend>>((await this.GetDataAsync(Runtime.GameUrl, "friend/getlist", "Get", "", 0))["list"].ToString());
		}

		// Token: 0x0600077E RID: 1918 RVA: 0x000622F8 File Offset: 0x000604F8
		public async Task<VisitorFriend> FriendVisitor(int uid)
		{
			return JsonConvert.DeserializeObject<VisitorFriend>((await this.GetDataAsync(Runtime.GameUrl, string.Format("friend/visitorFriend/{0}/", uid), "Get", "", 0)).ToString());
		}

		// Token: 0x0600077F RID: 1919 RVA: 0x00062348 File Offset: 0x00060548
		public async Task<FoundEnemyVO> FriendSpy(int uid, int fleetId)
		{
			return JsonConvert.DeserializeObject<FoundEnemyVO>((await this.GetDataAsync(Runtime.GameUrl, string.Format("friend/spy/{0}/{1}/", uid, fleetId), "Get", "", 0))["enemyVO"].ToString());
		}

		// Token: 0x06000780 RID: 1920 RVA: 0x000623A0 File Offset: 0x000605A0
		public async Task<WarReport> FriendChallenge(int uid, int fleetId, Formation formatin)
		{
			return JsonConvert.DeserializeObject<WarReport>((await this.GetDataAsync(Runtime.GameUrl, string.Format("friend/challenge/{0}/{1}/{2}/", uid, fleetId, (int)formatin), "Get", "", 0))["warReport"].ToString());
		}

		// Token: 0x06000781 RID: 1921 RVA: 0x00062400 File Offset: 0x00060600
		public async Task<BattleResult> FriendResult(bool isNightWar)
		{
			return JsonConvert.DeserializeObject<BattleResult>((await this.GetDataAsync(Runtime.GameUrl, string.Format("friend/getWarResult/{0}/", Convert.ToInt32(isNightWar)), "Get", "", 0)).ToString());
		}

		// Token: 0x06000782 RID: 1922 RVA: 0x00062450 File Offset: 0x00060650
		public async Task<CampaignFleet> CampaignFleet(int mission)
		{
			return JsonConvert.DeserializeObject<CampaignFleet>((await this.GetDataAsync(Runtime.GameUrl, string.Format("campaign/getFleet/{0}/", mission), "Get", "", 0)).ToString());
		}

		// Token: 0x06000783 RID: 1923 RVA: 0x000624A0 File Offset: 0x000606A0
		public async Task<JToken> CampaignChangeFleet(int mission, int shipId, int position)
		{
			return await this.GetDataAsync(Runtime.GameUrl, string.Format("campaign/changeFleet/{0}/{1}/{2}/", mission, shipId, position), "Get", "", 0);
		}

		// Token: 0x06000784 RID: 1924 RVA: 0x00062500 File Offset: 0x00060700
		public async Task<FoundEnemyVO> CampaignSpy(int mission)
		{
			return JsonConvert.DeserializeObject<FoundEnemyVO>((await this.GetDataAsync(Runtime.GameUrl, string.Format("campaign/spy/{0}/", mission), "Get", "", 0))["enemyVO"].ToString());
		}

		// Token: 0x06000785 RID: 1925 RVA: 0x00062550 File Offset: 0x00060750
		public async Task<DealNode> CampaignDeal(int mission, Formation formation)
		{
			return JsonConvert.DeserializeObject<DealNode>((await this.GetDataAsync(Runtime.GameUrl, string.Format("campaign/challenge/{0}/{1}", mission, (int)formation), "Get", "", 0)).ToString());
		}

		// Token: 0x06000786 RID: 1926 RVA: 0x000625A8 File Offset: 0x000607A8
		public async Task<BattleResult> CampaignResult(bool isNightWar)
		{
			return JsonConvert.DeserializeObject<BattleResult>((await this.GetDataAsync(Runtime.GameUrl, string.Format("campaign/getWarResult/{0}/", Convert.ToInt32(isNightWar)), "Get", "", 0)).ToString());
		}

		// Token: 0x06000787 RID: 1927 RVA: 0x000625F8 File Offset: 0x000607F8
		public async Task<JToken> EatCook(string cook)
		{
			return await this.GetDataAsync(Runtime.GameUrl, "live/eat/" + cook, "Get", "", 0);
		}

		// Token: 0x06000788 RID: 1928 RVA: 0x00062648 File Offset: 0x00060848
		public async Task<List<Tactic>> GetTactics()
		{
			return JsonConvert.DeserializeObject<List<Tactic>>((await this.GetDataAsync(Runtime.GameUrl, "/live/getTactics", "Get", "", 0))["tactics"].ToString());
		}

		// Token: 0x06000789 RID: 1929 RVA: 0x00062690 File Offset: 0x00060890
		public async Task<string> TokenAsync(string url, string action, string postData = "")
		{
			HttpWebRequest httpWebRequest = WebRequest.CreateHttp(url + action);
			httpWebRequest.Method = "POST";
			httpWebRequest.ContentType = "application/json";
			httpWebRequest.UserAgent = "okhttp/3.4.1";
			httpWebRequest.Date = DateTime.Now;
			httpWebRequest.Headers.Add("Authorization", (Runtime.Game.ServerType == 3) ? ("HMS 6f67d7612241:" + Remote.HmacSHA1("c918ae4f4a75464fa964093ae8a66dae", "POST\n" + httpWebRequest.Headers["Date"] + "\n/" + action)) : ("HMS 881d3SlFucX5R5hE:" + Remote.HmacSHA1("kHPmWZ4zQBYP24ubmJ5wA4oz0d8EgIFe", "POST\n" + httpWebRequest.Headers["Date"] + "\n/" + action)));
			if (postData != "")
			{
				byte[] bytes = Encoding.UTF8.GetBytes(postData);
				Stream requestStream = httpWebRequest.GetRequestStream();
				requestStream.Write(bytes, 0, bytes.Length);
				requestStream.Close();
			}
			WebResponse webResponse = await httpWebRequest.GetResponseAsync();
			string result = new StreamReader(webResponse.GetResponseStream(), Encoding.GetEncoding("UTF-8")).ReadToEnd();
			webResponse.Close();
			return result;
		}

		// Token: 0x0600078A RID: 1930 RVA: 0x000626E8 File Offset: 0x000608E8
		public async Task<string> JSONAsync(string url, string action, string method = "Get", string postData = "")
		{
			HttpWebRequest httpWebRequest = WebRequest.CreateHttp(url + action);
			httpWebRequest.Method = method.ToUpper();
			httpWebRequest.Accept = "application/json";
			httpWebRequest.ContentType = "application/json";
			httpWebRequest.UserAgent = "Dalvik/2.1.0 (Linux; U; Android 6.0; R11/MRA58K)";
			if (postData != "")
			{
				byte[] bytes = Encoding.UTF8.GetBytes(postData);
				Stream requestStream = httpWebRequest.GetRequestStream();
				requestStream.Write(bytes, 0, bytes.Length);
				requestStream.Close();
			}
			WebResponse webResponse = await httpWebRequest.GetResponseAsync();
			string result = new StreamReader(webResponse.GetResponseStream(), Encoding.GetEncoding("UTF-8")).ReadToEnd();
			webResponse.Close();
			return result;
		}

		// Token: 0x0600078B RID: 1931 RVA: 0x00062746 File Offset: 0x00060946
		private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
		{
			return true;
		}

		// Token: 0x0600078C RID: 1932 RVA: 0x0006274C File Offset: 0x0006094C
		public async Task<string> GetWebAsync(string url, string action, string method = "Get", string postData = "")
		{
			ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(Remote.CheckValidationResult);
			HttpWebRequest httpWebRequest = WebRequest.CreateHttp(url + action);
			httpWebRequest.Method = method.ToUpper();
			httpWebRequest.Accept = "identity";
			httpWebRequest.UserAgent = "Dalvik/2.1.0 (Linux; U; Android 6.0; R11/MRA58K)";
			if (method == "Post" && postData != "")
			{
				httpWebRequest.ContentType = "application/x-www-form-urlencoded";
				byte[] bytes = Encoding.UTF8.GetBytes(postData);
				Stream requestStream = httpWebRequest.GetRequestStream();
				requestStream.Write(bytes, 0, bytes.Length);
				requestStream.Close();
			}
			WebResponse webResponse = await httpWebRequest.GetResponseAsync();
			string result = new StreamReader(webResponse.GetResponseStream(), Encoding.GetEncoding("UTF-8")).ReadToEnd();
			webResponse.Close();
			return result;
		}

		// Token: 0x0600078D RID: 1933 RVA: 0x000627AC File Offset: 0x000609AC
		public async Task<string> GetUrlAsync(string url, string action, string method = "Get", string postData = "")
		{
			HttpWebRequest httpWebRequest = WebRequest.CreateHttp(string.Concat(new string[]
			{
				url,
				action,
				"&version=",
				Runtime.Server.Version,
				"&channel=",
				Runtime.Server.Channel,
				"&market=",
				Runtime.Server.Market
			}));
			httpWebRequest.Method = method.ToUpper();
			httpWebRequest.Accept = "identity";
			httpWebRequest.UserAgent = "Dalvik/2.1.0 (Linux; U; Android 6.0; R11/MRA58K)";
			WebResponse webResponse = await httpWebRequest.GetResponseAsync();
			string result = new StreamReader(webResponse.GetResponseStream(), Encoding.GetEncoding("UTF-8")).ReadToEnd();
			webResponse.Close();
			return result;
		}

		// Token: 0x0600078E RID: 1934 RVA: 0x00062804 File Offset: 0x00060A04
		private async Task<JToken> GetDataAsync(string url, string action, string method = "Get", string postData = "", int errnum = 0)
		{
			int num = 0;
			try
			{
				long ticks = DateTime.Now.Ticks;
				HttpWebRequest httpWebRequest = WebRequest.CreateHttp(string.Format("{0}{1}&t={2}&e={3}&gz=1&market={4}&channel={5}&version={6}", new object[]
				{
					url,
					action,
					ticks,
					Remote.Md5(action + "&t=" + ticks),
					Runtime.Server.Market,
					Runtime.Server.Channel,
					Runtime.Server.Version
				}));
				httpWebRequest.Method = method.ToUpper();
				httpWebRequest.Accept = "identity";
				httpWebRequest.UserAgent = "Dalvik/2.1.0 (Linux; U; Android 6.0; R11/MRA58K)";
				if (this.cookie != "")
				{
					httpWebRequest.Headers.Add("Cookie", this.cookie);
				}
				if (method == "Post" && postData != "")
				{
					httpWebRequest.ContentType = "application/x-www-form-urlencoded";
					byte[] bytes = Encoding.UTF8.GetBytes(postData);
					Stream requestStream = httpWebRequest.GetRequestStream();
					requestStream.Write(bytes, 0, bytes.Length);
					requestStream.Close();
				}
				WebResponse webResponse = await httpWebRequest.GetResponseAsync();
				if (webResponse.Headers.ToString().Contains("Set-Cookie"))
				{
					string text = webResponse.Headers.Get("SET-COOKIE");
					if (text.Contains("hf_skey"))
					{
						this.cookie = text.Replace("Path=/; ", "").Replace(",hf_skey", ";hf_skey").Replace(",QCLOUD", ";QCLOUD");
					}
				}
				string json;
				using (ZlibStream zlibStream = new ZlibStream(webResponse.GetResponseStream(), CompressionMode.Decompress))
				{
					json = new StreamReader(zlibStream, Encoding.GetEncoding("UTF-8")).ReadToEnd();
					webResponse.Close();
				}
				JToken jtoken = JToken.Parse(json);
				JToken first = jtoken.First;
				if (!(((first != null) ? first.Path : null) == "eid"))
				{
					if (jtoken.AsJEnumerable().Any((JToken i) => i.Path == "updateTaskVo"))
					{
						using (List<UserQuestUpdater>.Enumerator enumerator = JsonConvert.DeserializeObject<List<UserQuestUpdater>>(jtoken["updateTaskVo"].ToString()).GetEnumerator())
						{
							while (enumerator.MoveNext())
							{
								UserQuestUpdater l = enumerator.Current;
								if (Runtime.Game.UserTask.Any((UserQuest i) => i.taskCid == l.taskCid))
								{
									Runtime.Game.UserTask.Single((UserQuest i) => i.taskCid == l.taskCid).condition = l.condition;
								}
							}
						}
					}
					return jtoken;
				}
				int num2 = Convert.ToInt32(jtoken["eid"].ToString());
				if (num2 == -1)
				{
					await Task.Delay(2000);
					return await this.GetDataAsync(url, action, method, postData, 0);
				}
				if (num2 == -105 || num2 == -106 || num2 == -107 || num2 == -108 || num2 == -215 || num2 == -204)
				{
					foreach (AttackTask attackTask in Runtime.Game.AttackTasks)
					{
						attackTask.Enabled = false;
					}
					throw new SysException(string.Format("[游戏错误]({0}):{1}", num2, Runtime.Configs.errorCode[num2]));
				}
				if (num2 == -9999 || num2 == -9995)
				{
					throw new MaintainException(string.Format("[游戏错误]({0}):{1}", num2, Runtime.Configs.errorCode[num2]));
				}
				if (Runtime.Configs.errorCode.ContainsKey(num2))
				{
					string arg = Runtime.Configs.errorCode[num2];
					throw new SysException(string.Format("[游戏错误]({0}):{1}", num2, arg));
				}
				throw new SysException(string.Format("[游戏错误]({0}):未知服务器错误", num2));
			}
			catch (Exception obj)
			{
				num = 1;
			}
			JToken result;
			if (num == 1)
			{
				object obj;
				Exception ex = (Exception)obj;
				if (errnum >= 2)
				{
					throw ex;
				}
				MessagingCenter.Send<LogMessage>(new LogMessage("[详细]" + ex.Message), "FullLog");
				await Task.Delay(10000);
				errnum++;
				result = await this.GetDataAsync(url, action, method, postData, errnum);
			}
			return result;
		}

		// Token: 0x0600078F RID: 1935 RVA: 0x00062874 File Offset: 0x00060A74
		private string Base64Encode(Encoding encodeType, string source)
		{
			if (source == null)
			{
				return "";
			}
			byte[] bytes = encodeType.GetBytes(source);
			string result;
			try
			{
				result = Convert.ToBase64String(bytes);
			}
			catch
			{
				result = source;
			}
			return result;
		}

		// Token: 0x06000790 RID: 1936 RVA: 0x000628B4 File Offset: 0x00060AB4
		protected static string Md5(string strToEncrypt)
		{
			byte[] bytes = new UTF8Encoding().GetBytes(strToEncrypt + "ade2688f1904e9fb8d2efdb61b5e398a");
			byte[] array = new MD5CryptoServiceProvider().ComputeHash(bytes);
			string text = string.Empty;
			for (int i = 0; i < array.Length; i++)
			{
				text += Convert.ToString(array[i], 16).PadLeft(2, '0');
			}
			return text.PadLeft(32, '0');
		}

		// Token: 0x06000791 RID: 1937 RVA: 0x0006291C File Offset: 0x00060B1C
		public static string HmacSHA1(string key, string input)
		{
			byte[] bytes = Encoding.ASCII.GetBytes(key);
			byte[] bytes2 = Encoding.ASCII.GetBytes(input);
			return Convert.ToBase64String(new HMACSHA1(bytes).ComputeHash(bytes2));
		}

		// Token: 0x0400061A RID: 1562
		private string cookie;
	}
}
